<template>
	<div class="page-wrap">
		<!-- 湿沉降设置 -->
		<div class="page-content p-0">
			<div class="page-column p-0">
				<div class="page-form p-x-0">
					<el-form
						:model="ruleForm"
						:rules="rules"
						label-position="left"
						label-width="160px"
						ref="form"
						label-suffix="："
					>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">湿沉降设置</div>
								<el-form-item label="湿沉降线性因子" prop="WDCWASH1001">
									<el-input
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
										v-model="ruleForm.WDCWASH1001"
										size="medium"
										class="mediumForm"
									></el-input>
								</el-form-item>
								<el-form-item label="湿沉降指数因子" prop="WDCWASH2001">
									<el-input
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
										v-model="ruleForm.WDCWASH2001"
										size="medium"
										class="mediumForm"
									></el-input>
								</el-form-item>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">干沉降设置</div>
								<el-form-item label="干沉降粒径分组数" prop="DDNPSGRP001">
									<select-para
										v-model="ruleForm.DDNPSGRP001"
										:label.sync="ruleForm.DDNPSGRP001NAME"
										:options="DDNPSGRPoptions"
										class="mediumForm"
										defaultPara
										@change="DDNPSGRPChange"
									></select-para>
								</el-form-item>
								<el-form-item label="干沉降速度(m/s)" prop="name"></el-form-item>
								<el-table ref="multipleTable" :data="ruleForm.DDNPSGRPtab" tooltip-effect="dark" border>
									<el-table-column
										prop="RDCORINV_COR1"
										label="干沉降组1"
										align="center"
										min-width="120"
										v-if="this.ruleForm.DDNPSGRP001 >= 1"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR1"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR1'"
											>
												<el-input
													minlength="1"
													maxlength="20"
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR1"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR2"
										label="干沉降组2"
										align="center"
										min-width="120"
										v-if="this.ruleForm.DDNPSGRP001 >= 2"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR2"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR2'"
											>
												<el-input
													minlength="1"
													maxlength="20"
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR2"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR3"
										label="干沉降组3"
										align="center"
										min-width="120"
										v-if="this.ruleForm.DDNPSGRP001 >= 3"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR3"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR3'"
											>
												<el-input
													minlength="1"
													maxlength="20"
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR3"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR4"
										label="干沉降组4"
										align="center"
										min-width="120"
										v-if="this.ruleForm.DDNPSGRP001 >= 4"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR4"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR4'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR4"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR5"
										label="干沉降组5"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 5
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR5"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR5'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR5"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR6"
										label="干沉降组6"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 6
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR6"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR6'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR6"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR7"
										label="干沉降组7"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 7
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR7"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR7'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR7"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR8"
										label="干沉降组8"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 8
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR8"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR8'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR8"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR9"
										label="干沉降组9"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 9
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR9"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR9'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR9"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column
										prop="RDCORINV_COR10"
										label="干沉降组10"
										align="center"
										min-width="120"
										v-if="
												this.ruleForm.DDNPSGRP001 >= 10
											"
									>
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDCORINV_COR10"
												:prop="'DDNPSGRPtab.'+scope.$index+'.RDCORINV_COR10'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDCORINV_COR10"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
								</el-table>
								<el-form-item label="干沉降粒子组分布系数" label-width="170px" prop="name"></el-form-item>
								<el-table :data="ruleForm.RDPSDISTtab" style="width: 100%" @row-click='selectTableRow'>
									<el-table-column prop="date" align="center" label="核素分组" width="150"></el-table-column>
									<el-table-column label="干沉降粒径分组数">
										<el-table-column
											prop="RDPSDIST1"
											label="干沉降粒径分组数1"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=1"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST1"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST1'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST1"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST2"
											label="干沉降粒径分组数2"
											min-width="120"
											v-if="
													this.ruleForm.DDNPSGRP001 >=
														2
												"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST2"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST2'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST2"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST3"
											label="干沉降粒径分组数3"
											min-width="120"
											v-if="
													this.ruleForm.DDNPSGRP001 >=
														3
												"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST3"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST3'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST3"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST4"
											label="干沉降粒径分组数4"
											min-width="120"
											v-if="
													this.ruleForm.DDNPSGRP001 >=
														4
												"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST4"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST4'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST4"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST5"
											label="干沉降粒径分组数5"
											min-width="120"
											v-if="
													this.ruleForm.DDNPSGRP001 >=
														5
												"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST5"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST5'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST5"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST6"
											label="干沉降粒径分组数6"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=6"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST6"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST6'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST6"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST7"
											label="干沉降粒径分组数7"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=7"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST7"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST7'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST7"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST8"
											label="干沉降粒径分组数8"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=8"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST8"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST8'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST8"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST9"
											label="干沉降粒径分组数9"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=9"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST9"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST9'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST9"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column
											prop="RDPSDIST10"
											label="干沉降粒径分组数10"
											min-width="120"
											v-if="this.ruleForm.DDNPSGRP001 >=10"
										>
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.RDPSDIST10"
													:prop="'RDPSDISTtab.'+scope.$index+'.RDPSDIST10'"
												>
													<el-input
														minlength="1"
														maxlength="20"
														oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
														class="bigForm"
														v-model="scope.row.RDPSDIST10"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
									</el-table-column>
								</el-table>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<div class="bottom-btn">
					<el-button type="primary" :loading="loading" @click="submitFun">下一步</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import selectPara from "@/components/selectPara"
import commCheckbox from "@/components/commCheckbox"
import ImageCropper from "@/components/ImageCropper"
import FixBottomButton from "@/components/FixBottomButton"
import ueditor from "@/components/ueditor"
import textLength from "@/components/common/comp/textLength"
import { commPara } from "@/mixins/mixins"
import { mapState } from "vuex"
import { v0010, dome, selecttext } from "@/utils/verify.js"

export default {
	name: "aboutUs",
	props: {
		batchid: String,
	},
	mixins: [commPara],
	components: {
		selectPara,
		ImageCropper,
		textLength,
		commCheckbox,
		FixBottomButton,
		ueditor,
	},

	data() {
		var validateNum = (rule, value, callback) => {
			let rowIndex = rule.field.split('.')[1]
			let sum = (Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST1'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST2'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST3'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST4'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST5'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST6'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST7'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST8'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST9'])+Number(this.ruleForm.RDPSDISTtab[rowIndex]['RDPSDIST10']))
			if (value == "") {
				callback(new Error("输入值不能为空"))
			}else if (parseFloat(value) < 0.0 || value > 1.0) {
				callback(new Error("输入范围为[" + 0.0 + "，" + 1.0 + "]")) 
			}else if(sum>1){
				callback(new Error("干沉降粒子组分布系数之和为1"))
			}else{
				callback()
			}	
			
		};
		return {
			activeTab: "4",
			tableData: [],
			multipleSelection: [],
			dialogVisible: false,
			DDNPSGRPoptions: [],

			ruleForm: {
				WDCWASH1001: 9.5e-5,
				WDCWASH2001: 0.8,
				DDNPSGRP001: 1,
				DDNPSGRP001NAME: 1,
				DDNPSGRPtab: [
					{
						RDCORINV_COR1: "1",
						RDCORINV_COR2: "1",
						RDCORINV_COR3: "1",
						RDCORINV_COR4: "1",
						RDCORINV_COR5: "1",
						RDCORINV_COR6: "1",
						RDCORINV_COR7: "1",
						RDCORINV_COR8: "1",
						RDCORINV_COR9: "1",
						RDCORINV_COR10: "1",
					},
				],
				RDPSDISTtab: [],
			},
			rules: {
				WDCWASH1001: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				WDCWASH2001: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				DDNPSGRP001: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR10: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR1: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR2: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR3: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR4: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR5: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR6: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR7: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR8: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR9: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDCORINV_COR10: [
					{
						validator: v0010,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST1: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST2: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST3: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST4: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST5: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST6: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST7: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST8: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST9: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
				RDPSDIST10: [
					{
						validator: validateNum,
						trigger: ["change", "blur"],
					},
				],
			},
			loading: false,
			currentRow:{},
		}
	},
	computed: {
		...mapState({
			basic_Data: (state) => state.token.basic_Data,
		}),
	},
	mounted() {
		this.setDDNPSGRPoptions()
		this.setoption()
	},
	methods: {
		setoption() {
			//回显数据
			this.ruleForm.WDCWASH1001 = this.basic_Data.WDCWASH1001.toString()
			this.ruleForm.WDCWASH2001 = this.basic_Data.WDCWASH2001.toString()
			this.ruleForm.DDNPSGRP001 = this.basic_Data.DDNPSGRP001 || 1
			this.ruleForm.DDNPSGRPtab = [
				{
					RDCORINV_COR1: "",
					RDCORINV_COR2: "",
					RDCORINV_COR3: "",
					RDCORINV_COR4: "",
					RDCORINV_COR5: "",
					RDCORINV_COR6: "",
					RDCORINV_COR7: "",
					RDCORINV_COR8: "",
					RDCORINV_COR9: "",
					RDCORINV_COR10: "",
				},
			]
			this.basic_Data.DDVDEPOS_VALUE.forEach((item, index) => {
				let i = index + 1
				// console.log(item)
				this.ruleForm.DDNPSGRPtab[0]["RDCORINV_COR" + i] = item.toString()
			})
			// console.log(this.ruleForm.DDNPSGRPtab)

			this.ruleForm.RDPSDISTtab = this.basic_Data.ISMAXGRP001.map(
				(item) => {
					// console.log(item)
					return {
						date: item,
						RDPSDIST1: "",
						RDPSDIST2: "",
						RDPSDIST3: "",
						RDPSDIST4: "",
						RDPSDIST5: "",
						RDPSDIST6: "",
						RDPSDIST7: "",
						RDPSDIST8: "",
						RDPSDIST9: "",
						RDPSDIST10: "",
					}
				}
			)

			this.basic_Data.RDPSDIST.forEach((item, index) => {
				item.forEach((it, n) => {
					let i = n + 1
					this.ruleForm.RDPSDISTtab[index]["RDPSDIST" + i] = it.toString()
				})
			})
			console.log(this.ruleForm.RDPSDISTtab)
		},
		setDDNPSGRPoptions() {
			//设置下拉框选项
			this.DDNPSGRPoptions = []
			for (let index = 0; index < 10; index++) {
				this.DDNPSGRPoptions.push({
					label: index + 1,
					value: index + 1,
				})
			}
		},
		DDNPSGRPChange(value) {
			// console.log(value)
		},
		select() {
			this.dialogVisible = true
		},
		resetForm() {
			this.queryDetail()
		},
		selectTableRow(row, column, event){
			this.currentRow = row;
		},
		toggleSelection(rows) {
			if (rows) {
				rows.forEach((row) => {
					this.$refs.multipleTable.toggleRowSelection(row)
				})
			} else {
				this.$refs.multipleTable.clearSelection()
			}
		},
		handleSelectionChange(val) {
			this.multipleSelection = val
		},

		submitFun() {
			this.$refs.form.validate((valid) => {
				if (valid) {
					// console.log(this.ruleForm.DDNPSGRPtab)
					let tempDDVDEPOS_VALUE = []
					for (const key in this.ruleForm.DDNPSGRPtab[0]) {
						if (this.ruleForm.DDNPSGRPtab[0].hasOwnProperty(key)) {
							const element = this.ruleForm.DDNPSGRPtab[0][key]
							tempDDVDEPOS_VALUE.push(parseFloat(element))
						}
					}
					tempDDVDEPOS_VALUE.splice(
						parseInt(this.ruleForm.DDNPSGRP001),
						tempDDVDEPOS_VALUE.length
					)

					let tempRDPSDIST = this.ruleForm.RDPSDISTtab.map((item) => {
						let templist = []
						for (const key in item) {
							if (item.hasOwnProperty(key)) {
								const element = item[key]
								templist.push(parseFloat(element))
							}
						}
						templist.splice(0, 1)
						templist.splice(
							parseInt(this.ruleForm.DDNPSGRP001),
							templist.length
						)
						return templist
					})

					// console.log(this.basic_Data)
					let template = JSON.parse(JSON.stringify(this.basic_Data))
					// console.log(tempDDVDEPOS_VALUE)

					template.WDCWASH1001 = parseFloat(this.ruleForm.WDCWASH1001)
					template.WDCWASH2001 = parseFloat(this.ruleForm.WDCWASH2001)
					template.DDNPSGRP001 = parseInt(this.ruleForm.DDNPSGRP001)
					template.DDVDEPOS_VALUE = tempDDVDEPOS_VALUE
					template.RDPSDIST = tempRDPSDIST
					template.SETPAGEINDEX = this.activeTab
					this.$store.dispatch("upData_basic_Data", template)
					let params = {
						batchid: this.$props.batchid,
						batchinfo: "BASE",
						submitjson: JSON.stringify(template),
					}
					this.$appApi
						.BATCH_SUBMIT(params)
						.then((res) => {
							var str = res.data.substring(0, 1)
							if (str == "E") {
								let message = res.data.substring(6)
								this.$notify.error({
									title: "保存失败！",
									message: message,
									type: "success",
								})
							} else if (str == "S") {
								this.$notify({
									message: "保存成功！",
									type: "success",
								})
								this.$emit("changeActiveTab", this.activeTab)
					            this.$store.dispatch("change_basic_showTab", this.activeTab)
								if(activeTab >=9){
									this.$router.push({
										path: "/home",
									})
								}
							}
						})
						.catch((err) => {
							console.log(err)
						})

					// console.log(this.basic_Data)
					// console.log(this.activeTab)
				}
			})
		},
	},
}
</script>
<style lang="scss" scoped>
.page-flex-row /deep/ .el-collapse-item__header {
	background: #f3f9fe;
}
</style>